package ${package.ServiceImpl};

import com.baomidou.mybatisplus.core.metadata.IPage;
import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.io.IOException;
import org.springframework.stereotype.Service;

import java.util.List;
/**
 * <p>
 * ${table.comment!} 服务实现类
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
@Service
<#if kotlin>
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {

}
<#else>
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
    @Override
    public boolean create(${entity} ${entity?uncap_first}) {
        return save(${entity?uncap_first});
    }

    @Override
    public boolean delete(List<Long> ids) {
        return removeByIds(ids);
    }

    @Override
    public boolean update(${entity} ${entity?uncap_first}) {
        return updateById(${entity?uncap_first});
    }

    @Override
    public ${entity} queryById(Long id) {
        return getById(id);
    }

    @Override
    public List<${entity}> selectList() {
        QueryWrapper<${entity}> wrapper = new QueryWrapper<>();
        wrapper.lambda().orderByDesc(${entity}::getId);
        return list(wrapper);
    }

    @Override
    public IPage<${entity}> selectPage(IPage<${entity}> page) {
        QueryWrapper<${entity}> wrapper = new QueryWrapper<>();
        wrapper.lambda().orderByDesc(${entity}::getId);
        return page(page, wrapper);
    }

}
</#if>
